<?php
$dsn = "sqlsrv:Server=localhost;Database=Student";
$db = new PDO($dsn, "sa", "123456");

//修改Student表id=3的学生记录的班级id修改为2：
$updateSql = "UPDATE [dbo].[Student]
   SET [ClassId] = 1
 WHERE StudentId=16";
$result = $db->exec($updateSql);
var_dump($result);
if ($result) {
    echo "修改成功，影响行数：" . $result;
} else {
    echo "修改失败";
}